/*
 * Copyright (c) 2025 EasyAdmin
 * All rights reserved.
 *
 * This file is part of the [EasAdmin] project.
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 * Proprietary and confidential.
 *
 * Author: EasyAdmin ( 1073602@qq.com )
 * Website: https://www.xhxiao.com
 */
package ${table.packageName}.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.easy.framework.common.validate.Add;
import com.easy.framework.common.validate.Update;
import com.easy.framework.database.entity.${table.baseClass};
import com.easy.framework.poi.annotation.Excel;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

/**
 * ${table.tableComment} 实体
 *
 * @author ${table.author}
 * @date ${date}
 */
@Getter
@Setter
@TableName("${table.tableName}")
public class ${table.className} extends ${table.baseClass}
{

    private static final long serialVersionUID = 1L;

<#list table.fields as f>
   <#if (excludeFields?has_content == false) || (excludeFields?seq_contains(f.fieldName) == false)>

   /**
    * ${f.fieldComment}
    * <#if f.dictCode?? && f.dictCode != ''>字典代码：${f.dictCode}</#if>
    */
    @Excel(name = "${f.fieldComment}")
    <#if f.isRequired?? && f.isRequired == "1" && f.javaDataType != 'String'>
    @NotNull(message="${f.fieldComment}不能为空", groups = {<#if f.isInsert == "1">Add.class</#if><#if f.isInsert == "1" && f.isEdit == "1">,</#if><#if f.isEdit == "1">Update.class</#if>})
    <#elseif f.isRequired?? && f.isRequired == "1">
    @NotBlank(message="${f.fieldComment}不能为空", groups = {<#if f.isInsert == "1">Add.class</#if><#if f.isInsert == "1" && f.isEdit == "1">,</#if><#if f.isEdit == "1">Update.class</#if>})
    </#if>
    <#if f.javaDataType == 'String' && f.dataLength?? && f.dataLength gt 0>@Size(message = "${f.fieldComment}长度必须小于${f.dataLength}个字", max = ${f.dataLength}, groups = {Add.class, Update.class})</#if>
    <#if f.isPrimaryKey == "1">@TableId(type = IdType.INPUT)</#if>
    private ${f.javaDataType} ${f.javaFieldName};

    </#if>
</#list>
}